<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@include file="/WEB-INF/pages/common/common.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <title><spring:message code="title.ipic.target"/></title>
      <style type="text/css">
        .font_stress{
            color: red;font-size: 13px;font-weight:bold;
        }
    </style>
    <script type="text/javascript">
          var datagrid;
	        $(function() {
	            datagrid=$('#datagrid').datagrid({
	                onClickRow:function(rowIndex){
	                    var rows = datagrid.datagrid('getRows');
	                    for ( var i = 0; i < rows.length; i++) {
	                         datagrid.datagrid('endEdit', i);
	                    }
	                        datagrid.datagrid('beginEdit', rowIndex);
	                }
	            });
	           $('#supplierId').combogrid({
                panelWidth:300,
                idField:'id',
                textField:'code',
                fitColumns:true,
                nowrap:true,
                editable:false,
                pagination:{showPageList:false,showRefresh:false},
                url:'${path}/basedata/supplier/ajaxList.do',
                frozenColumns:[[
                    {field:'id',title:'ID',checkbox:true}
                ]],
                columns:[[
                    {field:'code',title:'供应商代码',width:140},
                    {field:'name',title:'供应商名称',width:160},
                    {field:'linkman',title:'质量负责人',width:140}
                ]],
                onSelect:function(rowIndex, rowData){
                    $("#supplierName").val(rowData['name']);
                }
            });
	            
	        });
	        
	       function save_(){
          
	         var isV =$("#tableForm").form("validate");
            if(!isV) return; 
            var rows = datagrid.datagrid('getRows');
            for ( var i = 0; i < rows.length; i++) {
		        datagrid.datagrid('endEdit', i);
		   	 }
		   	 var updateRows = $('#datagrid').datagrid('getChanges');
             if(updateRows==''){
	              $.messager.alert('<spring:message code='msg.tip'/>',"请填写月份记录后提交数据!");
	               return;
             }  
             
            imonJYRH.showZone();
            var effectData = new Object();
            effectData["answerDetail"] = JSON.stringify(rows);
            effectData["answer"] =  JSON.stringify(imonJYRH.serializeObject($("#tableForm *")));
            
            $.ajax({
                url : '${path}/business/supplier_quality/answer_problem/ajaxModify.do',
                 data : effectData,
                 cache : false,
                 async : true,
                 dataType : "json",
                success : function(reMsg) {
                    if(reMsg.success){
                        parent.returnResult();
                        message.show({ msg : reMsg.msg,title : '<spring:message code='msg.tip'/>',showType:'slide'});
                    }else{
                        if(!imonJYRH.isBlank(reMsg.obj)){
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['obj']);
                        }else{
                            $.messager.alert('<spring:message code='msg.tip'/>',reMsg['msg']);
                        }
                    }
                    imonJYRH.hideZone();
                }
            });
        }
        
      
    </script>
</head>
<body class="easyui-layout">
<div data-options="region:'center'">
    <div class="datagrid-toolbar" style="height:410px">
        <table width="100%" id="tableForm">
                <tr>
                    <td align="right"> <span style="color:red;">*</span>SupplierCode供应商编码：</td>
                    <td>
                        <input type="text" id="supplierId" name="supplierId" disabled  data-options="required:true" value="${vo.supplierId}"/>
                    </td>
                    <td align="right">SupplierName供应商名称：</td>
                    <td>
                        <input type="text" disabled name="supplierName" id="supplierName" value="${vo.supplierName}"/>
                    </td>
                    <td align="right"> <span style="color:red;">*</span>Year年份：</td>
                    <td>
                        <input type="text"  name="year" disabled class="easyui-numberbox" data-options="required:true" value="${vo.year}"/>
                    </td>
                </tr>
            </table>
        <hr width="650px"/>
        <table width="100%" id="datagrid" singleSelect="true"  class="tableForm">
            <thead>
            <tr>
                <th field="month" width="60"  hidden="true">>月份</th>
                <th field="months" width="60">月份</th>
                <th field="type" width="150"  data-options="editor:{type:'combobox',options:{valueField:'id',textField:'text',panelHeight:'auto',editable :false,
                data: [{
                		id: 'GOOD,VERY QUICK' ,
						text: 'GOOD,VERY QUICK',
						selected: 'true'     
					},{
						id: 'SATISFACTORY',
						text: 'SATISFACTORY'
					},{
						id: 'NOT GOOD',
						text: 'NOT GOOD'
					}],
					 onSelect:function(record){ 
                                        var row=datagrid.datagrid('getSelected');
                                        if(record.id=='GOOD,VERY QUICK'){
                                     	  row['value']= 5;
                                        }else if(record.id=='SATISFACTORY'){
                                      	  row['value']=3;
                                        }else {
                                     	   row['value']=0;
                                        }  
						           }   
							
                }}">选择</th>
                <th field="value" width="150">得分</th>
                <th field="comment" width="290" data-options="editor:{type:'text'}">评论</th>
            </tr>
            </thead>
            <tbody>
            <tr>
               <td  hidden="true">01</td>
                <td>一月</td>
                <td id="td1">${vo.januaryType}</td>
                <td>${vo.january}</td>
                <td>${vo.januaryComment}</td>
            </tr>
            <tr>
              <td  hidden="true">02</td>
                <td>二月</td>
                <td id="td1">${vo.februaryType}</td>
                <td>${vo.february}</td>
                <td>${vo.februaryComment}</td>
            </tr>
            <tr>
              <td  hidden="true">03</td>
                <td>三月</td>
                 <td id="td1">${vo.marchType}</td>
                <td>${vo.march}</td>
                <td>${vo.marchComment}</td>
            </tr>
            <tr>
              <td  hidden="true">04</td>
                <td>四月</td>
                 <td id="td1">${vo.aprilType}</td>
                <td>${vo.april}</td>
                <td>${vo.aprilComment}</td>
            </tr>
            <tr>
              <td  hidden="true">05</td>
                <td>五月</td>
                 <td id="td1">${vo.mayType}</td>
                <td>${vo.may}</td>
                <td>${vo.mayComment}</td>
            </tr>
            <tr>
              <td  hidden="true">06</td>
                <td>六月</td>
                 <td id="td1">${vo.juneType}</td>
                <td>${vo.june}</td>
                <td>${vo.juneComment}</td>
            </tr>
            <tr>
              <td  hidden="true">07</td>
                <td>七月</td>
                 <td id="td1">${vo.julyType}</td>
                <td>${vo.july}</td>
                <td>${vo.julyComment}</td>
            </tr>
            <tr>
              <td  hidden="true">08</td>
                <td>八月</td>
                <td id="td1">${vo.augustType}</td>
                <td>${vo.august}</td>
                <td>${vo.augustComment}</td>
            </tr>
            <tr>
              <td  hidden="true">09</td>
                <td>九月</td>
                 <td id="td1">${vo.septemberType}</td>
                <td>${vo.september}</td>
                <td>${vo.septemberComment}</td>
            </tr>
            <tr>
              <td  hidden="true">10</td>
                <td>十月</td>
                 <td id="td1">${vo.octoberType}</td>
                <td>${vo.october}</td>
                <td>${vo.octoberComment}</td>
            </tr>
            <tr>
            <td  hidden="true">11</td>
                <td>十一月</td>
                 <td id="td1">${vo.novemberType}</td>
                <td>${vo.november}</td>
                <td>${vo.novemberComment}</td>
            </tr>
            <tr>
            <td  hidden="true">11</td>
                <td>十二月</td>
                 <td id="td1">${vo.decemberType}</td>
                <td>${vo.december}</td>
                <td>${vo.decemberComment}</td>
            </tr>
            </tbody>
        </table>
        <br />
        <div align="right">
            <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-save" onclick="save_()">Save保存</a>
            <a class="easyui-linkbutton" href="javascript:void(0);" iconCls="icon-no" onclick="parent.operateDialog.dialog('close');">Close关闭</a>
        </div>
    </div>
</div>


</body>
</html>
